<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Page Title</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0,minimum-scale=1.0, maximum-scale=1.0,user-scalable=no">

  <!-- <link rel="stylesheet" href="./css/reset.css" /> -->

  <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.6.2/css/sm.min.css">

  <style>

    .content {
      padding: 20px;
    }

  </style>

</head>

<body>
  <!-- page集合的容器，里面放多个平行的.page，其他.page作为内联页面由路由控制展示 -->
  <div class="page-group">
    <!-- 单个page ,第一个.page默认被展示-->
    <div class="page">
      <!-- 这里是页面内容区 -->
      <div class="content">
        <div class="content-block">
          <header class="bar bar-nav">
            <h1 class='title'>毕业设计选题系统-登录</h1>
          </header>
          <div class="content" style="margin-top: 140px;">
            <div class="list-block">
              <ul>
                <!-- Text inputs -->
                <li>
                  <div class="item-content">
                    <div class="item-media"><i class="icon icon-form-name"></i></div>
                    <div class="item-inner">
                      <div class="item-input">
                        <input id="studentIdentifier" type="text" placeholder="请输入登录名">
                      </div>
                    </div>
                  </div>
                </li>
                <li>
                  <div class="item-content">
                    <div class="item-media"><i class="icon icon-form-password"></i></div>
                    <div class="item-inner">
                      <div class="item-input">
                        <input id="password" type="password" placeholder="请输入登录密码" class="">
                      </div>
                    </div>
                  </div>
                </li>
              </ul>
            </div>
            <div class="content-block">
              <div class="row">
                <div id="login" class="col-100"><a href="#" class="button button-big button-fill button-danger">立即登录</a></div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

</body>
<script type='text/javascript' src='//g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
<script type='text/javascript' src='//g.alicdn.com/msui/sm/0.6.2/js/sm.min.js' charset='utf-8'></script>
<script src="../js/jquery-3.2.1.min.js"></script>
<script src="../js/jquery.cookie.js"></script>
<script src="../plugins/layui/layui.js"></script>
<script src="../js/constant.js"></script>
<script>
  layui.use(["layer"], function() {
    
  
    $("#login").click(function () {
      
      var studentIdentifier = $("#studentIdentifier").val();
      var password = $("#password").val();
      if (studentIdentifier.length <= 0) {
        layer.msg("登录名不能为空！");
        // $.toast("登录名不能为空！");
        return;
      }
      if (password.length <= 0) {
        layer.msg("登录密码不能为空！");
        // $.toast("登录密码不能为空！");
        return;
      }
      $.post(getURL() + "student/verifyStudent", {
        studentIdentifier: studentIdentifier,
        password: password
      })
      .then(function(res) {
        // alert(111)
        if (res.isSuccessful) {
          cookieOpMod.add("userId", res.id);
          window.location.href = "../index.html"
        } else {
          $.toast(res.message);
        }
      })
    });
  });
</script>

</html>